import 'package:json_annotation/json_annotation.dart';

part 'community.g.dart'; // 这行是为json_serializable生成的

@JsonSerializable()
class Community {
  @JsonKey(name: 'id')
  final int? communityId;
  @JsonKey(name: 'name')
  final String? communityName;

  Community({this.communityId, this.communityName});

  factory Community.fromJson(Map<String, dynamic> json) => _$CommunityFromJson(json);
  Map<String, dynamic> toJson() => _$CommunityToJson(this);
}

@JsonSerializable()
class CommunityDetail {
  @JsonKey(name: 'id')
  final int? communityId;
  @JsonKey(name: 'name')
  final String? communityName;
  final String? introduction;
  @JsonKey(name: 'create_time')
  final DateTime? createTime;

  CommunityDetail({
    this.communityId,
    this.communityName,
    this.introduction,
    this.createTime,
  });

  factory CommunityDetail.fromJson(Map<String, dynamic> json) => _$CommunityDetailFromJson(json);
  Map<String, dynamic> toJson() => _$CommunityDetailToJson(this);
}